﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SchoolLibrary.DataBase
{
    public class Query
    {
        private const char PARAMETER_PREFIX = ':';
        private const char APOSTROPHE_SYMBOL = '\'';

        private string queryString;
        
        public Query(string query)
        {
            this.queryString = query;
        }

        public string QueryString
        {
            get { return queryString; }
        }

        public void setParameter(string name, object value)
        {
            queryString = queryString.Replace(PARAMETER_PREFIX + name,
                APOSTROPHE_SYMBOL + value.ToString() + APOSTROPHE_SYMBOL);
        }

        public void setStringParameter(string name, string value)
        {
            queryString = queryString.Replace(PARAMETER_PREFIX + name,  value);
        }
    }
}
